<style>
    h3{color:gray; border-bottom: 1px solid gray; margin-bottom: 20px;}
    #detalhes th{border:none; background-color: white; width: 200px; text-align: right; padding-right: 10px;}
    #detalhes td{}
    #portarias th{width: 110px;}
</style>
<?php
    $this->title = "Detalhe de evento";
    $this->headTitle($this->title);
?>
<a style="float:right; position: relative;" class="linkBtn" href="<?php echo $this->Referrer();?>">Voltar</a>
<h2><?php echo $this->data->evento; ?></h2><br/>

<div>
<h3>Metaeventos vinculados</h3>
<?php if($total_fabrica = count($this->grupo)):?>
    <table class="table table-condensed table-striped">
        <tr>
            <th>Metaevento</th>
            <th>Responsável</th>
            <th>Status</th>
        </tr>
        <?php foreach($this->grupo as $v): ?>
        <tr>
            <td><?php echo $v->curso; ?></td>
            <td><?php echo $v->nome;?></td>
            <td><?php echo $v->status; ?></td>
        </tr>
        <?php endforeach; ?>
    </table>
<?php else:?>
<p style="margin-top:20px;" class="alert alert-info">Nenhum metaevento foi associado!</p>
<?php endif;?>
</div>
<br/>
<div id="detalhes" class="row-fluid">
    <?php $v = $this->data; ?>
    <a class="pull-right" href="default/vendas/form/id/<?php echo $v['id'];?>">Editar</a>
    <h3>Detalhamento do evento</h3>
    <div class="span6" style="border-right: 1px solid gray; margin: 0;">
    <table class="table" style="width:500px; float: right;">
        <tr><th>Data de início:                 </th><td style="border:none;">   <?php echo $this->FormataData($v['dt_inicio']);     ?></td></tr>
        <tr><th>Data de término:                </th><td style="border:none;">   <?php echo $this->FormataData($v['dt_termino']);    ?></td></tr>
    </table>
    <table class="table table-striped" style="width:500px; float: right;">
        <tr><th>Carga horária:                  </th><td>   <?php echo $v['carga_horaria'];                     ?></td></tr>
        <tr><th>Alunos por turma:               </th><td>   <?php echo $v['alunos_por_turma'];                  ?></td></tr>
        <tr><th>Quantidade de turmas:           </th><td>   <?php echo $v['qtde_turmas'];                       ?></td></tr>
        <tr><th>Qtde de alunos inscritos: </th><td>   <?php echo $v['qtde_alunos_inscritos'];             ?></td></tr>
        <tr><th>Qtde de alunos aprovados: </th><td>   <?php echo $v['qtde_alunos_aprovados'];             ?></td></tr>
        <tr><th>Código do curso no Moodle:      </th><td>   <?php echo $v['mdl_curso_id'];                      ?></td></tr>
    </table>
    </div>
    <div class="span6" style="margin=0;">
    <table class="table table-striped" style="width:500px; float: right;">
        <tr><th>Demandante:                     </th><td>   <?php echo $v['demandante'];                        ?></td></tr>
        <tr><th>Contato (demandante):           </th><td>   <?php echo $v['demandante_contato'];                ?></td></tr>
        <tr><th>Previsto no PAC?</th><td>
        <?php if($v['pac']): ?>
                <img alt="PAC"  title="PAC" src="<?php echo $this->baseUrl().'/images/tick.png'; ?>"><span style="position:relative;top:-5px;"> Sim</span>
        <?php else: ?><span>Não</span>
        <?php endif; ?>
        </td></tr>
    </table>
    <table id="custos" class="table table-bordered table-striped" style="width:500px; float: right;">
        <tr><th colspan="2" style="border:1px solid gray; background-color: #eee; text-align: center;">Custo total do evento</th></tr>
        <tr><th>Custo médio tutor:              </th><td>   
            <span>custo médio por tutor = <?php echo $this->Real($v['custo_por_tutor']);?>, custo total = <?php echo $this->Real((float)$v['custo_por_tutor']*(int)$v['qtde_turmas']);?> (<?php
            echo $this->Plural((int)$v['qtde_turmas'],'tutor','tutores');?>)</span></td></tr>
        <tr><th>Custo médio supervisor:         </th><td>            <span>custo médio supervisor = <?php echo $this->Real($v['custo_supervisor']);?>, custo total do curso = <?php echo $this->Real((float)$v['custo_supervisor'] + (float)$v['custo_por_tutor']*(int)$v['qtde_turmas']);?> (1 supervisor e <?php
            echo $this->Plural((int)$v['qtde_turmas'],'tutor','tutores');?>)</span></td></tr>
        </td></tr>
    </table>
    <table id="portarias" class="table table-bordered table-striped" style="width:500px; float: right;">
        <tr><th colspan="2" style="border:1px solid gray; background-color: #eee; text-align: center;">Portarias</th></tr>
        <tr><th>Instituição:        </th><td>   <?php echo $v['portaria_instituicao'];              ?></td></tr>
        <tr><th>Matrícula:          </th><td>   <?php echo $v['portaria_matricula'];                ?></td></tr>
        <tr><th>Designação:         </th><td>   <?php echo $v['portaria_designacao'];               ?></td></tr>
        <tr><th>Homologação:        </th><td>   <?php echo $v['portaria_homologacao'];              ?></td></tr>
        <tr><th>Desligamento:       </th><td>   <?php echo $v['portaria_desligamento'];             ?></td></tr>
    </table>
    </div>
</div>
